package PracticeRC;

import com.thoughtworks.selenium.DefaultSelenium;

public class seleniumrc 
{
//	DefaultSelenium sel = new DefaultSelenium("localhost",4444,"firefox","http://redfin.com");
	//In case we want to run in a different server we need to give the IP address instead of localhost.
	//Even for server we can give the port as 4444 if it is giving error or problem we need change port or ask the server team for the port number.
	//For port we need to go to run-external tools-external tools dialog-arguments given the parameters "-jar selenium-server-standalone-2.39.0.jar -port xxxx"
	static DefaultSelenium sel = new DefaultSelenium("localhost",5555,"firefox","http://");
	public static void google() throws Exception {
		//We are starting object.
		sel.start();
		sel.open("https://www.google.com");
		sel.waitForPageToLoad("4000");
		sel.windowMaximize();
		//sel.type("//input[@id='gbqfq']", "hyderabad");
		sel.type("id=gbqfq", "hyderabad");
		sel.click("id=gbqfba");
		//sel.waitForPageToLoad("19000");
		Thread.sleep(5000);
		//sel.click("xpath=/html/body/div/div[4]/div[2]/div[6]/div/div[4]/div/div[2]/div[2]/div/ol/li/div/div/h3/a");
		
		if(sel.isElementPresent("//a[@class='q qs']"))
		{
			System.out.println("pass");
			
		}
	
		else
		{
			System.out.println("Fail");
		}
	}
	
	public static void main(String[] args) throws Exception
	{
		google();
		
	}
}

